Post

Replies

Boosts

Views

Activity

Reply to Binding UIImage from Image
Hello Claude,this was only for demonstration, not for work.but this not the solution, to change the data type from UIImage to Image, because I need it (datatype UIImage) for further procession in an UIKit View (datatype of struct WorkOnPicture).GreedsDWD
May ’20
Reply to Binding UIImage from Image
Hello Claude,so, I made an Example. The Error occures, wehn teh view "WorkOnPicture" with the Binding will be called. Only the struct ContentView should be modified...import SwiftUI import Combine class GetPicture: ObservableObject {//get picture from everywhere static let shared: GetPicture = GetPicture() let willChange = PassthroughSubject<Image?, Never>() @Published var image: Image? = nil { didSet { if image != nil { willChange.send(image) } } } func get() { image = Image("ExamplePNG") } } struct WorkOnPicture: View { @Binding var image: UIImage var body: some View { Text("Hello Picture") } } struct ContentView: View { @State var image: Image? = nil var body: some View { VStack { image?.resizable().frame(width: 100, height: 100) .contextMenu { Button(action: { self.workWithPicture() }) { Text("Edit") Image(systemName: "pencil") }.disabled(image == nil) } }.onReceive(GetPicture.shared.$image) { image in self.image = image } .onAppear() { GetPicture().get() } } func workWithPicture() { WorkOnPicture(image: image) //<- here is the problem } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }Kind regardsDWD
May ’20
Reply to Calling view and go back
Hello, Claude,Thank you very much. I see you made this whole thing a lot more flexible than I wanted. The second view is the detail view and is always the same for this species.My idea was to create a new element from a list (normal object) and then automatically go to the detail view instead of letting the user press a dummy entry.Your solution is simply ingenious.I will have a closer look at it in the next few hours.
Jan ’20
Reply to Navigation View on iPad?
Hello Claude,thanks for the confirmation. Let's hope that there will be a fix for this problem in the next version.Edit: Merci. I see that this is probably the automatic layout adjustment for the iPad, which is playing a trick here.Have a nice evening
Dec ’19